package hh;

import hh.engine.Table;
import hh.util.StringUtil;
import hh.visit.TemplateWriter;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 大部分方法是声明，这样就可以在jsp使用
 * 但是实现不是在这里
 */
public interface EmptyUtil {
    String newLine = "\n";
    TemplateWriter o = null;
    Table table = null;
    
    // 空方法
    public static void setOutputDir(String outputDir) {
    }
    
    public static String toCamelCaseRemovePre(String str, String... pres) {
        return StringUtil.toCamelCaseRemovePre(str, pres);
    }
    
    public static String toCamelCaseRemovePreAndSuffix(String str, String pre, String suffix) {
        return StringUtil.toCamelCaseRemovePreAndSuffix(str, pre, suffix);
    }
    
    public static String lowerFist(String name) {
        return Character.toLowerCase(name.charAt(0)) + name.substring(1);
    }
    
    public static String upperFist(String name) {
        return Character.toUpperCase(name.charAt(0)) + name.substring(1);
    }
    
    public static String toCamelCaseRemoveSuffix(String str, String... suffies) {
        return StringUtil.toCamelCaseRemoveSuffix(str, suffies);
    }
    
    public static StringBuilder generateImportStr(List<String> imports) {
        StringBuilder sb = new StringBuilder(100);
        List<String> collect = imports.stream().distinct().collect(Collectors.toList());
        for (int i = 0; i < collect.size(); i++) {
            if(i!=0) sb.append('\n');
            sb.append("import ").append(collect.get(i)).append(';');
        }
        return sb;
    }
    
    public static String toCamelCase(String str) {
        return StringUtil.toCamelCase(str);
    }
    
    
    // empty 实现
    public static String getDoName(Table table) {
        return null;
    }
    
    public static String getDaoName(Table table) {
        return null;
    }
    
    public static String getDaoImplName(Table table) {
        return null;
    }
    
    public static String getServiceName(Table table) {
        return null;
    }
    
    public static String getServiceImplName(Table table) {
        return null;
    }
    
    public static String getApiName(Table table) {
        return null;
    }
    
    public static String getApiImplName(Table table) {
        return null;
    }
}
